
import {getSearchHot,delSearchHistory,getSearch} from '../../api';

export function searchAction(){
    return async(dispatch:Function)=>{
        const result = await getSearchHot();
        dispatch({
            type:'INIT_SEARCH',
            payload:result.data
        })
    }
}
export function delHistoryAction(){
    return async(dispatch:Function)=>{
        const result = await delSearchHistory();
        dispatch({
            type:'DEL_HISTORY',
            payload:result.data
        })
    }
}
export function getSearchAction(keyword: string,page:string,size:string,order:string,categoryId:string,sort:string){
    return async(dispatch:Function)=>{
        const result = await getSearch(keyword,page,size,order,categoryId,sort);
        dispatch({
            type:'GET_SEARCH',
            payload:result.data
        })
    }
}

